<div class="am-u-sm-12 widget main-w">
    <ol class="am-breadcrumb">
        <li>
            <a href="{:url('/admin/index')}">首页</a>
        </li>
        <li class="am-active">统计报表</li>
        <li class="am-active">财务报表</li>
        <li class="am-active">交通明细</li>
    </ol>
    <form class="am-form-inline tpl-form-border-form" action="" method="get">
        <div>
            <div style="float:left;margin-right:20px;">
                <input type='text' name='company'  style="width:200px;height: 38px;"  placeholder="请输入公司名称" value="{$Think.get.company}"/>
            </div>
            <div style="float:left;margin-right:20px;">
                <input type='text' name='name'  style="width:200px;height: 38px;"  placeholder="请输入乘客人" value="{$Think.get.name}"/>
            </div>
            <div class="layui-input-inline" style="float:left;margin-right:20px;">
                <input type="text" name='start_time' class="layui-input" id="start_time" placeholder="开始时间" value="{$Think.get.start_time}">
            </div>
            <div class="layui-input-inline" style="float:left;margin-right:20px;">
                <input type="text" name='end_time' class="layui-input" id="end_time" placeholder="结束时间" value="{$Think.get.end_time}">
            </div>


            <div class="am-u-sm-6" style="float:left;">
                <button type="submit" class="am-btn am-btn-sm am-btn-primary am-radius" style="margin-top: -2px;">查询<i class="am-icon-search"></i></button>
            </div>
        </div>
    </form>

    
        <form class="am-form tpl-form-border-form tpl-form-border-br cl-p cl-m" action="trafficDetail_outexcel" method="get">
            <input type="hidden"  name="company" value="{$Think.get.company}" />
            <input type="hidden"  name="name" value="{$Think.get.name}" />
            <input type="hidden" name="start_time" value="{$Think.get.start_time}" >
            <input type="hidden" name="end_time" value="{$Think.get.end_time}" >

            <div class="am-btn-group am-u-sm-12 am-btn-group-xs cl-p">

                <button  class="am-btn am-btn-default am-fr" style="float: right;">导出数据</button>
            </div>

        </form>
    <div style="overflow-x:scroll;" class="am-u-sm-12 cl-p">
        <table width="100%" class="am-table am-table-compact am-table-bordered am-table-radius am-table-striped am-text-truncate tpl-table-black">
            <thead>
                <tr>
                    <th>订单编号</th>
                    <th>乘车人</th>
                    <th>联系电话</th>
                    <th>用车说明</th>
                    <th>出发地点</th>
                    <th>到达地点</th>
                    <th>出发时间</th>
                    <th>到达时间</th>
                    <th>用车类别</th>
                    <th>订车类别</th>
                    <th>车辆类型</th>
                    <th>司机姓名</th>
                    <th>车牌</th>
                    <th>类型</th>
                    <th>里程</th>
                    <th>耗时</th>
                    <th>折扣(100%)</th>
                    <th>原价金额</th>
                    <th>结算金额</th>			
                </tr>
            </thead>
            <tbody>
                {foreach $data as $key => $item}
                <tr>
                    <td>{$item.order_no}</td>
                    <td>{$item.passenger_name}</td>
                    <td>{$item.passenger_phone}</td>
                    <td>{$item.use_explain}</td>
                    <td>{if condition="$item['from_addr'] eq null"}暂无数据
                        {else/}{$item.from_addr}{/if}
                    </td>
                    <td>{if condition="$item['to_addr'] eq null"}暂无数据
                        {else/}{$item.to_addr}{/if}</td>
                    <td>{$item.go_time}</td>
                    <td>{$item.arrival_time}</td>
                    <td>{if in_array($item['type'],[4,5])}社会车{else/}公务车{/if}
                    </td>
                    <td>{if condition="$item['booking_type'] eq 1"}订车（日常）
                        {elseif condition="$item['booking_type'] eq 2"}包车
                        {elseif condition="$item['booking_type'] eq 3"}分时租赁
                        {elseif condition="$item['booking_type'] eq null"}暂无数据
                        {/if}
                    </td>
                    <td>{if condition="$item['car_type_name']"}{$item.car_type_name}
                        {else/}暂无数据{/if}
                    </td>
                    <td>{if condition="$item['name']"}{$item.name}
                        {else/}暂无数据{/if}</td>
                    <td>{$item.car_number}</td>
                    <td>{if condition="$item['pay_type'] eq 1"}个人
                        {elseif condition="$item['pay_type'] eq 2"}单位支付 
                        {elseif condition="$item['pay_type'] eq 3"}财政支付
                        {elseif condition="$item['pay_type'] eq 4"}自有用车
                        {elseif condition="$item['pay_type'] eq null"}暂无数据
                        {/if}
                    </td>
                    <td><?php echo ($item['meter']/1000).'公里';?></td>
                    <td>
                        <?php
                        $enddate=$item['arrival_time'];$startdate=$item['go_time'];
                        $date=floor((strtotime($enddate)-strtotime($startdate))/86400);
                        $hour=floor((strtotime($enddate)-strtotime($startdate))%86400/3600);
                        $minute=floor((strtotime($enddate)-strtotime($startdate))%86400/60);
                        $second=floor((strtotime($enddate)-strtotime($startdate))%86400%60);
                        echo $date."天".$hour."小时".$minute."分钟".$second."秒";

                        ?>
                    </td>
                    <td>{if condition="$item['discount']"}{$item.discount}%{else/}暂无数据{/if}</td>
                    <td>{if condition="$item['order_money']"}{$item.order_money}
                        {else/}暂无数据{/if}</td>
                    <td>{if condition="$item['passenger_money']"}{$item.passenger_money}
                        {else/}暂无数据{/if}</td>



                </tr>
                {/foreach}
                <!-- more data -->
            </tbody>
        </table>
        <div class="am-u-lg-12 am-cf">

            <div class="am-fr">

            </div>
        </div>

    </div>
    <span style='float:right;'>{$data->render()}</span>
</div>